local skel = fk.CreateSkill {
  name = "emo__dujin",
}

Fk:loadTranslationTable{
  ["emo__dujin"] = "独进",
  [":emo__dujin"] = "你可以打出一张牌以使用【决斗】，若打出的牌不为装备牌，你移动场上一张装备牌，且本回合你不能再打出牌。",

  ["#emo__dujin"] = "打出一张牌以使用【决斗】",
  ["#emo__dujin-move"] = "移动场上一张装备牌！",
  ["@@emo__dujin-turn"] = "<font color='red'>独进:禁打出</font>",

  ["$emo__dujin1"] = "带兵十万，不如老夫多甲一件！",
  ["$emo__dujin2"] = "轻舟独进，破敌先锋！",
}


skel:addEffect("viewas", {
  pattern = "duel|0|nosuit|none",
  anim_type = "offensive",
  prompt = "#emo__dujin",
  mute_card = true,
  card_filter = function (self, player, to_select, selected)
    return #selected == 0 and not player:prohibitResponse(Fk:getCardById(to_select))
  end,
  view_as = function (self, player, cards)
    if #cards ~= 1 then return nil end
    local c = Fk:cloneCard("duel")
    c.skillName = skel.name
    c:addFakeSubcard(cards[1])
    return c
  end,
  before_use = function (self, player, use)
    local room = player.room
    local cid = use.card.fake_subcards[1]
    if cid == nil then return "" end
    local card = Fk:getCardById(cid)
    room:responseCard{
      from = player, card = card
    }
    if player:isAlive() and card.type ~= Card.TypeEquip then
      room:setPlayerMark(player, "@@emo__dujin-turn", 1)
      if #room:canMoveCardInBoard("e") > 0 then
        local tos = room:askToChooseToMoveCardInBoard(player, {
          skill_name = skel.name, flag = "e", cancelable = false, prompt = "#emo__dujin-move",
        })
        if #tos == 2 then
          room:askToMoveCardInBoard(player, {
            flag = "e", skill_name = skel.name, target_one = tos[1], target_two = tos[2],
          })
        end
      end
    end
  end,
})

skel:addEffect("prohibit", {
  prohibit_response = function (self, player, card)
    return player:getMark("@@emo__dujin-turn") ~= 0
  end,
})

return skel
